import java.util.*;

public class collectionMethod {
    public static void main(String[] args) {
        @SuppressWarnings({"all"})
        List list = new ArrayList();
        list.add("jack");
        list.add(10);
        list.add(true);
        System.out.println("list="+list);
        //list.remove(0);//删除第一个元素；//两种删除方法
        list.remove("jack");
        System.out.println("list="+list);
        System.out.println(list.contains("jack")); 
        System.out.println(list.size());
        System.out.println(list.isEmpty());
        list.clear();
        System.out.println(list);
        ArrayList list2 = new ArrayList();
        list2.add("红楼梦");
        list2.add("三国演义");
        list.add("liaozhai");
        list.addAll(list2);
        System.out.println(list);
        System.out.println(list.containsAll(list2));
        //list.removeAll(list2);
        System.out.println(list);
        Iterator it = list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
            
        }
        
    }
    
}
